/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.isfd.constant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 结果库采集状态
 * 文件上传状态,0-未完成，可继续上传；1-上传成功；2-上传失败
 *
 * @author hxloongs
 * @date 2025-3-24
 */
@AllArgsConstructor
@Getter
public enum IsfdLargeFileStatusEnum {
    INCOMPLETE(0, "未完成，可继续上传"),
    SUCCESS(1, "上传成功"),
    FAIL(2, "上传失败");
    private final Integer value;
    private final String desc;

    public static String getDescByValue(Integer value) {
        IsfdLargeFileStatusEnum compressionTypeEnum = forValue(value);
        if (compressionTypeEnum == null) {
            return null;
        }
        return compressionTypeEnum.getDesc();
    }

    public static IsfdLargeFileStatusEnum forValue(Integer value) {
        if (value == null) {
            return null;
        }
        for (IsfdLargeFileStatusEnum compressionTypeEnum : IsfdLargeFileStatusEnum.values()) {
            if (compressionTypeEnum.getValue().equals(value)) {
                return compressionTypeEnum;
            }
        }
        return null;
    }

    public static IsfdLargeFileStatusEnum forDesc(String desc) {
        if (desc == null) {
            return null;
        }
        for (IsfdLargeFileStatusEnum compressionTypeEnum : IsfdLargeFileStatusEnum.values()) {
            if (desc.equals(compressionTypeEnum.getDesc())) {
                return compressionTypeEnum;
            }
        }
        return null;
    }
}
